﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities;

namespace Abp0713Demo.HistoryData
{
    /// <summary>
    /// 历史数据  Id为时间的长整型
    /// 此表设计为复合主键,点和时间复合为主键,可以让多个点在同一张表,
    /// 这是一张历史数据表,如果以后数据量多,按时间(月或日)进行分表
    /// </summary>
    public class HistoryDataTable : Entity<long>
    {
        /// <summary>
        /// 点编号
        /// </summary>
        [Key]
        [Column(Order = 1)]
        public int PointId { get; set; }

        [Key,DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(Order = 2)]
        public override long Id { get; set; }

        

        /// <summary>
        /// 值
        /// </summary>
        public double Value { get; set; }

        public DateTime Time
        {
            get { return DateTimeHelper.ConvertLongToDateTime(this.Id); }
        }
    }
}